/*
  ANCMedia v.3
  Author: Suzuki_aka
  Pm: suzuki_aka , meoit, es.utehy@gmail.com 
*/
var $_ = function (e) {
    return document.getElementById(e)
};
String.prototype.GetPart = function (e) {
    e = this.substr(this.indexOf("#") + 1).match(RegExp("(^|&)" + e + "=([^&]*)(&|$)"));
    return null != e ? unescape(e[2]) : null
};

function ANCMedia() {
    w = anc.gackiem.width;
    h = anc.gackiem.height;
    logo = anc.gackiem.logo;
    proxy = anc.gackiem.proxy;
    player = anc.gackiem.player;
    sk = anc.gackiem.skin;
    position = anc.gackiem.position;
    margin = anc.gackiem.margin;
    dl = anc.id.data;
    pl = anc.id.pl;
    tp = anc.id.tp;
    playing = anc.id.playing;
    home = anc.you.home;
    ver = "ANCMedia 3.0.3";
    author = "Suzuki_aka";
    m_data = $_(dl).innerHTML;
    r_left = '<div  id="r_data" style="display:none !important;" title="Data here  !">';
    r_right = "</div>";
    m_data = m_data.replace(/\[id\]/gi, r_left);
    m_data = m_data.replace(/\[\/id\]/gi, r_right);
    m_data = m_data.replace(/\<id\>/gi, r_left);
    m_data = m_data.replace(/\<\/id\>/gi, r_right);
    m_data = m_data.replace(/\<mp\>/gi, r_left);
    m_data = m_data.replace(/\<\/mp\>/gi, r_right);
    m_data = m_data.replace(/\<\!\-\-/gi, r_left);
    m_data = m_data.replace(/\-\-\>/gi, r_right);
    $_(dl).innerHTML = m_data;
    data = m_data = $_("r_data").innerHTML;
    l_spi = data.split("|").length;
    l_spk = function (d) {
        return data.split("|")[d].split(";").length
    };
    d_spi = function (d) {
        return data.split("|")[d]
    };
    d_spk = function (d, f) {
        return data.split("|")[d].split(";")[f]
    };
    part = [];
    pc = "0,a,b,c,d,e,f,g,h,i,k,l,m,n,o,p,q,r,s".split(",");
    ab = "";
    part_ep = "";
    data_out = "";
    css = "<style>/*\n\t" + ver + ";\n\tAuthor: " + author + ";\n\tWebsite: http://MaPhim.Net;\n*/\n#anc_tp,table{border:  3px solid green; width: 660px;}td{border: 1px solid  red;}td.svs{width:15%!important;  padding:4px;}td.eps{width:85%!important; padding:4px;}td.eps  li{margin-left:4px; float: left!important; list-style:  none;}.clear{clear:both!important;}</style>";
    document.write(css);
    this.Play = function () {
        for (var d = 0; d < sv.length; d++) part[d] = '<tr class="sv_rows"  id="' + sv[d] + '"><td class="svs"><span  class="' + sv[d].replace(/\./gi, "_") + '">Server ' + sv[d] + '</span></td><td class="eps">';
        for (var f = 0; f < l_spi; f++) {
            name_ep = d_spk(f, 0);
            for (var e = 0; e < l_spk(f); e++)
                if (link_ep = d_spk(f, e), number_ep = Number(d_spk(f, 0)), number_epp = "", 0 < f && (number_epp = Number(d_spk(f - 1, 0))), 2 == l_spk(f) ? part_ep = ab = "" : (ab = pc[e], part_ep = "-" + e), number_ep ? name_eppart = name_ep + ab : name_eppart = name_ep + part_ep, "" != d_spk(f, e))
                    for (d = 0; d < sv.length; d++) - 1 != d_spk(f, e).indexOf(sv[d]) && (part[d] += '<li><a  rel="' + ver + " - " + home + ":" + name_eppart + '" title="' + name_eppart + " -  " + ver + '" href="#p=' + f + "/" + e + "/" + name_eppart.replace(/ /gi, "_") + '" onclick="M.Load(\'' + link_ep + "','" + name_eppart + "');\">" + name_eppart + "</a> | </li><\!--ANCMedia Part--\>")
        }
        data_out += "<table>";
        if (2 <= l_spi)
            for (d = 0; d < sv.length; d++) - 1 != part[d].indexOf("ANCMedia") && (data_out += part[d] + "<div  id='" + d + "' class='clear' /></td></td>");
        else data_out += '<tr class="sv_rows" id="Full_' + home + '"><td class="svs"><span class="home">Server  ' + home + '</span></td><td class="eps"><li><a  rel="' + ver + " - " + home + ': Xem \u0111\u1ea7y \u0111\u1ee7" title="Xem  \u0111\u1ea7y \u0111\u1ee7 - ' + ver + '"  href="javascript:M.Load(\'' + data + '\',\'Full_time\');">Xem  \u0111\u1ea7y \u0111\u1ee7</a></li><div id="home"  class="clear"  /></td></td>';
        data_out += "</table>";
        $_(tp).innerHTML = data_out
    };
    this.Load = function (d, f) {
        obj = "";
        name_ep = ""; - 1 != d.indexOf(sv[0]) && (d = d.match(/\b\?[\W\w]*/gi), obj = e(d)[1]); - 1 != d.indexOf(sv[1]) && (d = d.replace(/\/nghe\?L\=/gi, "/l/"), obj = e(d)[2]); - 1 != d.indexOf(sv[2]) && 1 >= d.indexOf(sv[6]) && (obj = e(d)[3]); - 1 != d.indexOf(sv[3]) && (d = d.replace(/\.anc/gi, ".flv"), obj = e(d)[3]); - 1 != d.indexOf(sv[4]) && (d = d.replace(/anc\.yl/gi, "http://gdata.youtube.com/feeds/api/playlists"), obj = e(d)[0]); - 1 != d.indexOf(sv[5]) && (d = d.replace(/videos/gi, "embed"), d = d + "?w=" + w + "&h=" + h + "", obj = e(d)[4]); - 1 != d.indexOf(sv[6]) && (obj = e(d)[5]);
        for (var g = 6; g < sv.length; g++) - 1 != d.indexOf(sv[g]) && (obj = e(d)[0]);
        Number(f) ? name_ep = "\u0110ang xem t\u1eadp: " + f + "" : 5 <= f.length ? name_ep = "\u0110ang xem: " + f + "" : !Number(f) && 5 > f.length && (name_ep = "\u0110ang xem ph\u1ea7n: " + f + "");
        $_(pl).innerHTML = obj;
        $_(playing).innerHTML = name_ep
    };
    var e = function (d) {
        _mode = 'allowfullscreen="true" allowscriptaccess="always" width="' + w + '" height="' + h + '" autostart="true" type="application/x-shockwave-flash"';
        _add = "autostart=true&amp;skin=" + sk + '" src="' + player + "?logo.file=" + logo + "&amp;logo.hide=false&amp;logo.position=" + position + "&amp;logo.margin=" + margin + '"';
        return obj = ['<embed id="player" flashvars="plugins=' + proxy + "&proxy.link=" + d + "&amp;" + _add + " " + _mode + " />", '<embed id="player" src=http://video.google.com/googleplayer.swf' + d + "&hl=vi&fs=true  " + _mode + "> </embed>", '<embed id="player" ' + _mode + ' src=  "' + d + '" ></embed>', '<embed id="player"  flashvars="file=' + d + "&amp;" + _add + " " + _mode + " />", '<iframe  id="player" src="' + d + '" ' + _mode + ' frameborder="0"  scrolling="no"></iframe>', "<embed " + _mode + '  pluginspage="http://www.macromedia.com/go/getflashplayer"  src="' + d + '"/>']
    };
    this.Qstr = function () {
        str = window.location.href;
        part = str.GetPart("p");
        null == part && (part = "0/1/" + d_spk(0, 0) + "");
        a = part.split("/")[0];
        b = part.split("/")[1];
        c = decodeURI(part.split("/")[2]);
        2 <= l_spi ? this.Load(d_spk(a, b), c) : this.Load(data, "Full_time")
    }
}
M = new ANCMedia;
M.Play();
M.Qstr();